package com.hellogood.yaohuo.server.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import com.hellogood.yaohuo.server.db.DBHelper;

public class VersionDAO extends DBHelper {
	Logger log = Logger.getLogger(this.getClass());

	@Override
	public List<?> initializeObject(ResultSet rs) throws SQLException {

		List<String> list = new ArrayList<String>();
		if (rs != null) {
			while (rs.next()) {
				String version = rs.getString("version");
				list.add(version);
			}
		}
		return list;

	}

	@SuppressWarnings("unchecked")
	public String getVersion() {
		List<String> list = new ArrayList<String>();
		String sql = "SELECT * FROM version";
		list = (List<String>) super.query(sql);
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}
}
